<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
class CreateBalanceLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('balance_logs', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->comment('用户ID');
            $table->integer('balance_before')->comment('交易前余额');
            $table->integer('balance_after')->comment('交易后余额');
            $table->integer('money')->comment('交易金额');
            $table->integer('btype')->comment('交易类型:1出款2入款');
            $table->integer('sub_btype')->comment('子类型：1充值，2提现，3红包，4红包退款，5提现退款');
            $table->timestamps();
        });
        DB::statement("alter table `balance_logs` comment'资金日志表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('balance_logs');
    }
}
